package ru.spb.osll.myfit.client.view;

import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public abstract class AbstractView implements IView {
  protected VerticalPanel m_editPanel = new VerticalPanel();
  protected Widget m_contentPanel;
  protected VerticalPanel m_rootPanel = new VerticalPanel();

  public Widget getRootWidget() {
    return m_rootPanel;
  }

  protected void createRootPanel() {

    m_rootPanel.setStyleName("root-panel");

    Label myFitLabel = new Label();
    myFitLabel.setStyleName("main-label");
    m_rootPanel.add(myFitLabel);

    createEditPanel();
    m_contentPanel = createContentPanel();

    m_rootPanel.add(m_editPanel);
    m_rootPanel.add(m_contentPanel);
  }

  protected abstract Widget createContentPanel();

  protected void createEditPanel() {
    m_editPanel.setSpacing(6);
    m_editPanel.setStyleName("editPanelTitle");
  }
}
